#pragma once

#include <vector>
#include <deque>
#include "win32thread.h"
#include "itaskmgr.h"

using namespace std;

class CXWinTaskMgr : public ITaskMgr
{
public:

	CXWinTaskMgr();

    ~CXWinTaskMgr();

    int Init();

    int ProcessTasks(ITask**,int);

	ITask* GetTask();

private:
	CRITICAL_SECTION _cs;

	vector<IThread*> _threads;
	HANDLE*          _mutexes;
	HANDLE*          _events;

	UINT          _threadcount;
    UINT          _taskscount;

    deque<ITask*> _tasks_low;
    deque<ITask*> _tasks_normal;
    deque<ITask*> _tasks_high;
};